<?php


namespace app\common\validate;


class ArticleValidate extends CommonValidate
{
    protected $rule = [
        'article_id'      => 'require|integer|between:1,100000000',
        'article_name'    => 'require|chsAlphaNum|length:1,30',
        'article_content' => 'require|length:1,6000',
    ];

    protected $message = [
        'article_id.require'       => '请输入 id',
        'article_id.integer'       => 'id 必须是整数',
        'article_id.between'       => 'id 格式错误',
        'article_name.require'     => '请输入文章名',
        'article_name.chsAlphaNum' => '文章名必须是1-30个汉字、字母或数字',
        'article_name.length'      => '文章名必须是1-30个汉字、字母或数字',
        'article_content.require'  => '请输入文章内容',
        'article_content.length'   => '文章内容字节数必须是1-6000个',
    ];

    protected $scene = [
        'postArticle'   => ['group_name', 'article_content'],
        'putArticle'    => ['article_id', 'group_name', 'article_content'],
        'deleteArticle' => ['article_id'],
    ];
}